package com.vtuzx.kingdee.xqc_batch.component;

import com.vtuzx.batch.component.IVtuzxBatchComponent;
import com.vtuzx.core.bean.dto.VtuzxMap;
import com.vtuzx.core.utils.VtuzxUtil;
import com.vtuzx.kingdee.xqc_core.service.IVtuzxCoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Calendar;
import java.util.Date;

@Component("sync_returnProduct")
public class syncReturnProduct implements IVtuzxBatchComponent {

    @Autowired
    private IVtuzxCoreService coreService;


    @Override
    public void execute(VtuzxMap param) throws Exception {
        int day = VtuzxUtil.getInt(param, "day", 7);
        Date now = new Date();
        coreService.syncReturnProduct(VtuzxUtil.calcDate(now, Calendar.DAY_OF_MONTH, -day), now);
    }
}
